package com.fh.Servlet_exer;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * @author 方小勤
 * @version 1.0~
 * 2. 使用 idea 开发一个 DogServlet ,要求完成 梳理思路
 * (1) 通过继承 HttpServlet 开发该 Servlet
 * (2) 要求访问 url 为 http://localhost:8080/servlet/dog
 * (3) 当访问时，分别输出 get 和 post 访问的次数(即分开统计)
 * (4) 在 web.xml 配置, 使用前面的 login.html,
 */
public class home02 extends HttpServlet {
    private int Getcount = 0;
    private int Postcount = 0;
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("doGet访问次数："+ Getcount++);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("doPost访问次数："+ Postcount++);
    }
}
